<?php

include "connect.php";

if (isset($_GET['coding'])) {
$barcode = $_GET['coding'];
$result = mysql_query("SELECT * FROM patrons WHERE code='$barcode'");
$num_rows = mysql_num_rows($result);

if ($num_rows == 0) { 
header("Location: index.php?codenf=nf");
}
else {
Session_start();
session_regenerate_id();
$_SESSION["books"]=array();
header("Location: checkoutk.php?patron_coding=$barcode");
}
}
else { 
header("Location: index.php?checkempty=nf");
}
?>